// Copyright (C) 2022 Linlexiao
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QLabel>
#include <QMainWindow>
#include <QResizeEvent>

#include "fureferencewidget.h"
#include "logic/problem.h"
#include "pailabel.h"
#include "pointreferencewidget.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow {
    Q_OBJECT

 public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    ProblemGenerator *problemGenerator{};

 private:
    const QString sep = ")";
    const int VERSION = 1;  //判定问题代码版本的标识符 不同标识符之间不兼容
    const int SPACER = 10;
    void initLabels();
    void newProblem();
    void setProblem(const Problem &p);
    bool nowSolving;

    PointReferenceWidget *pointReferenceWidget;
    FuReferenceWidget *fuReferenceWidget;

    Ui::MainWindow *ui;
    Problem problem;
    QVector<PaiLabel *> leftLabels;
    QVector<PaiLabel *> rightLabels;
    PaiLabel *agariLabel{};

    QVector<PaiLabel *> doraLabels;
    QVector<PaiLabel *> uraLabels;
    void resizeEvent(QResizeEvent *event) override;
 public slots:
    void onClick();
    void onImportProblem();
    void onExportProblem();
    void onPointRefernce(bool b);
    void onFuRefernce(bool b);
};
#endif  // MAINWINDOW_H
